package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {
        File file = new File("./demo.txt");
        //获取名字
        String name = file.getName();
        System.out.println("名字:" + name);
        //占用的字节量
        long length = file.length();
        System.out.println("大小:" + length + "字节");
        //是否可读
        boolean cr = file.canRead();
        //是否可写
        boolean cw = file.canWrite();
        System.out.println("可读:" + cr);
        System.out.println("可写:" + cw);
        //是否隐藏
        boolean ih = file.isHidden();
        System.out.println("是否隐藏:" + ih);
    }
}
